import BaseApi from "@/api/BaseApi"

import type LoginReq from "@/type/LoginReq.ts";
import type SysUserDetailResp from "@/type/resp/sys-user-detail-resp.ts";

class SysApi extends BaseApi {

    constructor() {
        super('/sys/')
    }

    /**
     * 获取登录验证码
     */
    getCaptcha = () => {
        return this.get<any, never>("getCaptcha")
    }

    /**
     * 登录
     * @param userLogin
     */
    login = (userLogin: LoginReq) => {
        return this.post<SysUserDetailResp, LoginReq>("login", userLogin)
    }

    /**
     * 退出
     */
    logout = () => {
        return this.post<SysUserDetailResp, LoginReq>("logout")
    }
}

export default new SysApi()
